function result=d(varargin)
%Dice rolling fuction. 
% d(a,b)   rolls an 'a' sided die 'b' times. 
% d(a,b,c) rolls an 'a' sided die 'b' times and adds 'c' to the result. 
if(nargin==2)
	result = sum(randi(varargin{1},varargin{2},1));
elseif(nargin==3)
	result = sum(randi(varargin{1},varargin{2},1)) + varargin{3};
end
end